package com.qq.UserMapper;

import com.qq.shrio.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface UserMapper {

    //查询用户姓名+工号
    @Select("select *  from user where name=#{name} and password = #{password}")
    public User selectUserByNamePassword(String name, String password);

    //根据name查权限
    @Select("select permissions from user u,user_post up,position pos,pos_per pp,permissions per " +
            "where name=#{name} and u.id=up.user_id and pos.id=up.pos_id and pos.id=pp.pos_id and per.id=pp.per_id")
    List<String> selectRoleByName(String name);
}
